<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./lib/moment.2.24.0.js"></script>
    <script src="./lib/vue2.4.4.js"></script>
    <!-- `vue-resource` 依赖于 `vue` -->
    <script src="./lib/vue-resource1.3.4.js"></script>
</head>

<body>
    <div id="app">
        <a href="#" @click.prevent="componentId='login'">登录</a>
        <a href="#" @click.prevent="componentId='register'">注册</a>
        <component :is="componentId"></component>
    </div>
    <template id="loginTpl">
        <h3>登录组件</h3>
    </template>
    <template id="registerTpl">
        <h3>注册组件</h3>
    </template>
    <script>
        Vue.component('login', {
            template: '#loginTpl'
        });
        Vue.component('register', {
            template: '#registerTpl'
        });
        var vm = new Vue({
            el: '#app',
            data: {
                componentId: 'login'
            },
            methods: {
            }
        });
    </script>
</body>

</html>